// import LoginRequiredError from "./Error/LoginRequiredError";
import { ErrorMessage } from "../interface/IFace";
import { Controller } from './Controller';

export default class Decorator{
    public static params(params){
        /**
         * 
         */
        return (target, propertyKey: string, descriptor: PropertyDescriptor)=>{
            console.log(params)
        }
    }
    
    /**
     * 参数必填装饰器
     * @param target 类名称
     * @param propertyKey 方法名称 
     * @param parameterIndex 
     */
    public static require(target, propertyKey: string, parameterIndex: number){
        console.log(target,parameterIndex,propertyKey)
    }

    public static requireLogined(target:Controller, propertyKey: string, descriptor: PropertyDescriptor){
        if(target._isLogined)
        throw new Error(ErrorMessage.LoginRequired)
    }
}